cmake_minimum_required(VERSION 3.10)

project(qtvplugin_orbit VERSION 1.0 LANGUAGES CXX)
set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)


find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets Concurrent Sql REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets Concurrent Sql REQUIRED)

set(PRJ_HEADERS
	../qtviewer_planetosm/osmtiles/layer_interface.h
	../qtviewer_planetosm/osmtiles/viewer_interface.h
	../geocalc/geocalc.h
	qtvplugin_orbit.h
	orbit_elems.h
	orbit/core/cEci.h
	orbit/core/cJulian.h
	orbit/core/coord.h
	orbit/core/coreLib.h
	orbit/core/cSite.h
	orbit/core/cTLE.h
	orbit/core/cVector.h
	orbit/core/exceptions.h
	orbit/core/globals.h
	orbit/core/stdafx.h
	orbit/orbit/cNoradBase.h
	orbit/orbit/cNoradSDP4.h
	orbit/orbit/cNoradSGP4.h
	orbit/orbit/cOrbit.h
	orbit/orbit/cSatellite.h
	orbit/orbit/orbitLib.h
	orbit/orbit/stdafx.h
)

set(PRJ_SOURCES
	qtvplugin_orbit.cpp
	qtvplugin_orbit.cpp
	qtvplugin_orbit_tle.cpp
	qtvplugin_orbit_trace.cpp
	orbit/core/cEci.cpp
	orbit/core/cJulian.cpp
	orbit/core/coord.cpp
	orbit/core/cSite.cpp
	orbit/core/cTLE.cpp
	orbit/core/cVector.cpp
	orbit/core/globals.cpp
	orbit/orbit/cNoradBase.cpp
	orbit/orbit/cNoradSDP4.cpp
	orbit/orbit/cNoradSGP4.cpp
	orbit/orbit/cOrbit.cpp
	orbit/orbit/cSatellite.cpp

)

set(PRJ_FORMS
	qtvplugin_orbit.ui
)

set(PRJ_RESOURCES
	resources.qrc
	qtvplugin_orbit_zh_CN.ts
)

include_directories(orbit/orbit)
include_directories(orbit/core)

add_library(qtvplugin_orbit SHARED
	${PRJ_HEADERS}
	${PRJ_SOURCES}
	${PRJ_FORMS}
	${PRJ_RESOURCES}
)


target_compile_definitions(qtvplugin_orbit PRIVATE PLANETOSM_EXPORT_DLL)
target_link_libraries(qtvplugin_orbit PRIVATE
	Qt${QT_VERSION_MAJOR}::Widgets
	Qt${QT_VERSION_MAJOR}::Concurrent
	Qt${QT_VERSION_MAJOR}::Sql
)
